package com.devops.admin.service;

import com.devops.admin.po.DOSK8sDeployment;
import com.devops.admin.vo.DOSDeploymentVo;
import com.devops.admin.vo.DOSNamespaceChart;

import java.io.IOException;
import java.util.List;

/**
 * @ClassName DOSK8sDeploymentService
 * @Description TODO
 * @Author hepingguo
 * @Date 2022/5/20 08:43
 * @Version 1.0
 **/
public interface DOSK8sDeploymentService {

    /**
     * @Author heyabo
     * @Description 根据页面传过来的vo查询数据库里的deployment信息 封装数据格式并返回
     * @Date 16:11 2022/5/18
     * @Param [namespaceChart]
     * @return
     **/
    DOSNamespaceChart dealDbDeployment(DOSDeploymentVo deployment) throws IOException;

    /**
     * 获取k8s集群里的deployment详情
     * @param namespaceChart
     * @return
     */
    List<DOSK8sDeployment> getK8sDeploymentInfo(DOSNamespaceChart namespaceChart);

    /**
     * @Author heyabo
     * @Description 对deployment扩容
     * @Date 11:20 2022/5/20
     * @Param [releaseId, scale, deploymentName]
     * @return boolean
     **/
    boolean scaleDeployment(int releaseId, int scale, String deploymentName,Integer type);

    /**
     * @Author heyabo
     * @Description 重启deployment
     * @Date 11:28 2022/5/20
     * @Param [releaseId, deploymentName]
     * @return boolean
     **/
    boolean restartDeployment(int releaseId, String deploymentName,Integer type);

    /**
     * @Author heyabo
     * @Description 删除deployment
     * @Date 13:56 2022/5/20
     * @Param [releaseId, deploymentName]
     * @return boolean
     **/
    boolean deleteDeployment(int releaseId, String deploymentName,Integer type);

    /**
     * @Author heyabo
     * @Description 根据releaseId重启release
     * @Date 15:30 2022/6/27
     * @Param [releaseId]
     * @return boolean
     **/
    boolean restartRelease(Integer releaseId) throws IOException;

    boolean restartReleaseByName(String releaseName) throws IOException;

    List<DOSK8sDeployment> queryDeploymentInfo(int clusterId, String deploymentName);

    void restart(int clusterId, String namespace, String deploymentName);
}
